//
//  BaseHttpRequest.h
//  GSDache
//
//  Created by tanyin on 16/11/28.
//  Copyright © 2016年 tanyin. All rights reserved.
//

#import <Foundation/Foundation.h>
@class BaseHttpRequestModel, AFHTTPSessionManager;

typedef void(^progress)(NSProgress *);
typedef void(^success)(NSURLSessionDataTask *, id);
typedef void(^failure)(NSURLSessionDataTask *, NSError *);

@interface BaseHttpRequest : NSObject

@property (nonatomic, strong, readonly)AFHTTPSessionManager *session;
/*
 *  @brief 访问服务器
 */

-(NSURLSessionDataTask *)post:(BaseHttpRequestModel *)uploadDataModel
                      success:(success)success
                      failure:(failure)failure;

-(void)postFile:(BaseHttpRequestModel *)uploadDataModel
       progress:(progress)progress
        success:(success)success
        failure:(failure)failure;

-(NSURLSessionDataTask *)get:(BaseHttpRequestModel *)uploadDataModel
                     success:(success)success
                     failure:(failure)failure;

-(NSURLSessionDataTask *)put:(BaseHttpRequestModel *)uploadDataModel
                     success:(success)success
                     failure:(failure)failure;

-(NSURLSessionDataTask *)delete:(BaseHttpRequestModel *)uploadDataModel
                        success:(success)success
                        failure:(failure)failure;

@end
